#!/bin/sh

if [ -z $1 ]; then
    echo "Usage: $0 [REPOS Name]"
    exit 1
fi

REPOS=$1

cd /var/www/svn/
svnadmin create $REPOS
chown -R apache.apache $REPOS
chcon -R -t httpd_sys_content_t $REPOS
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags,doc,release}
svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/$REPOS/

MyAddr=`ifconfig eth0 | grep "inet addr" | awk -F: '{ print $2 }' | awk '{ print $1 }'`
echo "Access Subversion : http://$MyAddr/svn/$REPOS/"
echo "Done!"
